﻿// ----------------------------------------------------------------------
// <copyright file="Program.cs" company="Axitech">
//     Copyright (c) Axitech. All rights reserved.
// </copyright>
// <author>Anton Prilepskiy</author>
// <email>a.prilepskiy@axitech.ru</email>
// <cvs>$Id$</cvs>
// ----------------------------------------------------------------------

namespace Axitech.PlaylistCreator
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;

    class Program
    {
        private static String mHtmlPath = "animejapan.ru.html";
        private static String mPlaylistPath = "playlist.m3u";

        static void Main(string[] args)
        {
            var m3u = String.Empty;
            if (File.Exists(mHtmlPath))
            {
                var sr = new StreamReader(mHtmlPath);
                String html = sr.ReadToEnd();
                m3u = HtmlParser.Parse(html);
            }
            try
            {
                var file = new System.IO.StreamWriter(mPlaylistPath);
                file.WriteLine(m3u);
                file.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(String.Format("Exception: {0}", ex.Message));
            }
        }
    }
}
